package com.admin.utils.constant;

import lombok.Getter;
import lombok.Setter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import com.admin.mds.system.model.entity.SysRoleEntity;





/**
 * 系统用户
 *
 * @author monxz
 * @Date 2021年1月29日下午6:49:02
 * @Des
 *
 */
@Getter
@Setter
public class GlobleSysUser  extends User{


	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 用户ID
	 */
	private String userId;

	/**
	 * 用户账号
	 */
	private String userName;

	/**
	 * 用户昵称
	 */
	private String nickName;

	/**
	 * 用户类型（00系统用户）
	 */
	private String userType;

	/**
	 * 用户邮箱
	 */
	private String email;

	/**
	 * 手机号码
	 */
	private String phonenumber;

	/**
	 * 用户性别（0男 1女 2未知）
	 */
	private String sex;

	/**
	 * 头像地址
	 */
	private String avatar;

	/**
	 * 密码
	 */
	private String password;

	/**
	 * 帐号状态（0正常 1停用）
	 */
	private String status;

	/**
	 * 删除标志（0代表存在 2代表删除）
	 */
	private String delFlag;

	/**
	 * 创建者
	 */
	private String createBy;

	/**
	 * 用户角色
	 */
	private List<String> roles;
	
	
	/**
	 * 用户最大角色级别
	 */
	private Integer maxRoleLevel;

	/**
	 * 用户权限字符
	 */
	private List<String> permissions;

	/**
	 * 备注
	 */
	private String remark;

	private List<SysRoleEntity>  roleList = new ArrayList<SysRoleEntity>();
	
	private Long lastTime;
	
	/*
	 * 构造新的构造方法，解决内部类序列化得问题
	 */
	public GlobleSysUser(String username, String password, 
			String userId,  String nickName, String userType, String email, String phonenumber,
			String sex, String avatar, String password2, String status, String delFlag, String createBy,
			List<String> roles, Integer maxRoleLevel, List<String> permissions, 
			String remark,List<SysRoleEntity>  roleList,Long lastTime) {
		super(username, password, new ArrayList<>());
		this.userId = userId;
		userName = username;
		this.nickName = nickName;
		this.userType = userType;
		this.email = email;
		this.phonenumber = phonenumber;
		this.sex = sex;
		this.avatar = avatar;
		password = password2;
		this.status = status;
		this.delFlag = delFlag;
		this.createBy = createBy;
		this.roles = roles;
		this.maxRoleLevel = maxRoleLevel;
		this.permissions = permissions;
		this.remark = remark;
		this.roleList = roleList;
		this.lastTime = lastTime;
	}


	public GlobleSysUser(String username, String password, Collection<? extends GrantedAuthority> authorities,Long lastTime) {
		super(username, password, authorities);		
		this.lastTime = lastTime;
	}
	
	



	

}